Skip to main content

All Questions

4votes
4answers
509views

Finding Special Parts in a Word

Task description: Imagine you have a long word made up of small letters like "a", "b", "c", ancd so on. Let’s call this word a puzzle word. We want to look at all the ...
CodeCrusader's user avatar
3votes
1answer
177views

Snail matrix in Java - version III (generalizing)

Once again, in the previous version, Alexander Ivanchenko helped me with his awesome answer. Now, I have improved the toString() and, also, generalized the class ...
coderodde's user avatar
2votes
1answer
132views

Related to DSA: Find longest common prefix

The objective of below code is find longest common prefix from trie DataStructure which is written in Java. Code: ...
RWLKfjs's user avatar
7votes
1answer
341views

Create tweet threads from String in Java

I recently got this question in an exam, this is how I implemented, it is working fine. However, I would like to know if the code can be improved, as I think it for sure needs to be improved. The ...
isanma's user avatar
4votes
1answer
334views

A different approach to string pattern matching algorithm

Although there exists the most efficient "Knuth-Morris-Pratt" algorithm of string pattern matching. I tried to achieve the same result with a different approach. But I am not sure about it's ...
Deepeshkumar's user avatar
3votes
1answer
123views

Substring search in Java

I am trying to make an algorithm that will find the index of a given substring (which I have labeled pattern) in a given String (...
qwerty's user avatar
1vote
3answers
118views

Identifying indices of non-delimited characters in a string, supporting greater than 1 length of delimiters

The code below takes a string that potentially contains a true match for a delimiter. There can be multiple delimiters located anywhere in the string. We need to obtain the indices that are not a ...
Jason p's user avatar
4votes
1answer
462views

Hamming distance implementation in Java

I'm exploring String relativity and comparison techniques, and I found Hamming distance algorithm in my search so I give a try to implement that approach in Java and below I'm sharing my ...
Simmant's user avatar
3votes
1answer
254views

Knuth-Morris-Pratt algorithm in Java Finding substrings in a matrix

Problem Given two matrices: a pattern p and a text t. Write a program that counts the number of occurrences of ...
a-ina's user avatar
3votes
1answer
265views

LeetCode Reverse Words in a String without using any java library

The following problem is from LeetCode: Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. ...
Neelabh Singh's user avatar
3votes
2answers
120views

Reverse chars of each word in a string

An algorithm to reverse characters of each word in a sentence. What would be your concerns regarding the following solution? Example input: "I love New York" output: "I evol weN kroY" ...
khadrawy's user avatar
2votes
1answer
108views

Find the number of all specific substrings in a string

I would like to ask a code review regarding a concrete exercise. Let's suppose I have to get the number of all specific substrings in a string. We call something specific if any of these conditions ...
Csongi Nagy's user avatar
1vote
3answers
216views

Armstrong number generator

This is my code to generate all possible Armstrong numbers between the two given numbers. The logic uses string instead of integer to separate the digits to optimize the code. ...
Akshay soni's user avatar
-2votes
2answers
194views

ArmstrongNumber checker

This is my code written to check whether a given number is armstrong or not . but the logic differs from the conventional logic of using integer and separating its digits and calculating , instead i ...
Akshay soni's user avatar
3votes
2answers
1kviews

Counting the number of ways to decode a string

I am working on problem where I need to decode a string: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... '...
user5447339's user avatar

153050per page
close